#ifndef _CSPRITE_H
#define _CSPRITE_H


#include "CAnimation.h"



class CSprite
{
public:
	//--------------------------------------------//
	//	Constructor and Destructor for this class //
	//--------------------------------------------//
	CSprite();
	CSprite( int NumFrame , int NumFrameInRow , int width , int height);
	~CSprite();

	//--------------------------------//
	//	Public methods for this class //
	//--------------------------------//


	//Update and render methods inherit from base class
	void		Update					( float deltaTime );


	//Set methods
	void		SetAnimation			( CAnimation* Animation );
	void		SetAnimationIndex		( ULONG CurrAnimationIndex );
	void		SetScale				( float xScaleRatio , float yScaleRatio , D3DXVECTOR2 vecScaleCenter = D3DXVECTOR2(0 , 0) );
	void		SetColorAlpha			( int a , int r = 255 , int g = 255 , int b = 255 );
	void		SetAngle				( float angle , D3DXVECTOR2 vecRotateCenter = D3DXVECTOR2(0,0) );

	//Get methods
	ULONG		GetCurrAnimationIndex	( );
	float		GetXScaleRatio			( );
	float		GetYScaleRatio			( );
	float		GetAngle				( );
	D3DCOLOR	GetColor				( );
	D3DXVECTOR2	GetVecRotateCenter		( );
	D3DXVECTOR2	GetVecScaleCenter		( );
	CAnimation*	GetAnimation			( int index = -1 );
	RECT		GetSourceRect			( );


	//Release method
	void		Release					( );
private:
	//------------------------------------//
	//	Private variables for this classs //
	//------------------------------------//
	int			 m_nNumFrame;					// Total frame of this sprite
	int			 m_nNumFrameInRow;				// Total frame in 1 row
	int			 m_nSpriteWidth;
	int			 m_nSpriteHeight;

	RECT		 m_scrRect;						// The source rect of this sprite

	D3DCOLOR	 m_Color;						// Hold the color type ARGB of this sprite
	D3DXVECTOR2	 m_vecScaleCenter;				// The center of this sprite for scale
	float		 m_XScaleRatio;					// The X scaling factor
	float		 m_YScaleRatio;					// The Y scaling factor

	D3DXVECTOR2	 m_vecRotateCenter;				// The center of this sprite for rotate
	float		 m_fAngle;						// The angle of this sprite

	CAnimation	*m_pAnimation;					// Hold the array of an animation info of this sprite
	ULONG		 m_nCurrentAnimation;			// The current animation index

};


#endif